<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no, email=no" />
<title>jQuery移动设备图片裁剪代码 - 站长素材</title>

<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/css/default.css">
<style>
#clipArea {
	margin: 20px;
	height: 300px;
}
#file,
#clipBtn {
	margin: 20px;
}
#view {
	margin: 0 auto;
	width: 240px;
	height: 180px;
}
</style>

</head>
<body ontouchstart="">

<article class="zzsc-container">
	<div id="clipArea"></div>
	<input type="file" id="file">
	<button id="clipBtn">截取</button>
	<div id="view"></div>
</article>

<script src="__PUBLIC__/Home/js/jquery-2.1.1.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/Home/js/iscroll-zoom.js"></script>
<script src="__PUBLIC__/Home/js/hammer.js"></script>
<script src="__PUBLIC__/Home/js/jquery.photoClip.js"></script>
<script>
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
$("#clipArea").photoClip({
	width: 240,
	height: 180,
	file: "#file",
	view: "#view",
	ok: "#clipBtn",
	loadStart: function() {
		console.log("照片读取中");
	},
	loadComplete: function() {
		console.log("照片读取完成");
	},
	clipFinish: function(dataURL) {
		console.log(dataURL);
	}
});
</script>

<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>适用浏览器：360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. 不支持IE8及以下浏览器。</p>
<p>来源：<a href="http://sc.chinaz.com/" target="_blank">站长素材</a></p>
</div>
</body>
</html>